home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Folders.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  10.5 KB  |  314 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Folders.h
  3.  
  4.      Contains:    Folder Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __FOLDERS__
  19. #define __FOLDERS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=mac68k
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47.  
  48. enum {
  49.     kOnSystemDisk                = 0x8000
  50. };
  51.  
  52.  
  53. enum {
  54.     kCreateFolder                = true,
  55.     kDontCreateFolder            = false
  56. };
  57.  
  58.  
  59. enum {
  60.     kSystemFolderType            = FOUR_CHAR_CODE('macs'),        /* the system folder */
  61.     kDesktopFolderType            = FOUR_CHAR_CODE('desk'),        /* the desktop folder; objects in this folder show on the desk top. */
  62.     kTrashFolderType            = FOUR_CHAR_CODE('trsh'),        /* the trash folder; objects in this folder show up in the trash */
  63.     kWhereToEmptyTrashFolderType = FOUR_CHAR_CODE('empt'),        /* the "empty trash" folder; Finder starts empty from here down */
  64.     kPrintMonitorDocsFolderType    = FOUR_CHAR_CODE('prnt'),        /* Print Monitor documents */
  65.     kStartupFolderType            = FOUR_CHAR_CODE('strt'),        /* Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here */
  66.     kShutdownFolderType            = FOUR_CHAR_CODE('shdf'),        /* Finder objects (applications, documents, DAs, aliases, to...) to open at shutdown go here */
  67.     kAppleMenuFolderType        = FOUR_CHAR_CODE('amnu'),        /* Finder objects to put into the Apple menu go here */
  68.     kControlPanelFolderType        = FOUR_CHAR_CODE('ctrl'),        /* Control Panels go here (may contain INITs) */
  69.     kExtensionFolderType        = FOUR_CHAR_CODE('extn'),        /* Finder extensions go here */
  70.     kFontsFolderType            = FOUR_CHAR_CODE('font'),        /* Fonts go here */
  71.     kPreferencesFolderType        = FOUR_CHAR_CODE('pref'),        /* preferences for applications go here */
  72.     kTemporaryFolderType        = FOUR_CHAR_CODE('temp')        /* temporary files go here (deleted periodically, but don't rely on it.) */
  73. };
  74.  
  75. /*
  76.     Note:     The FindFolder trap was not implemented until System 7.  If you want to call FindFolder
  77.             while running on System 6 machines, then define USE_FINDFOLDER_GLUE and link with
  78.             Interface.o which contains glue to implement FindFolder on pre-System 7 machines.
  79. */
  80. #ifdef USE_FINDFOLDER_GLUE
  81. EXTERN_API( OSErr )
  82. FindFolder                        (short                     vRefNum,
  83.                                  OSType                 folderType,
  84.                                  Boolean                 createFolder,
  85.                                  short *                foundVRefNum,
  86.                                  long *                    foundDirID);
  87.  
  88. #else
  89. EXTERN_API( OSErr )
  90. FindFolder                        (short                     vRefNum,
  91.                                  OSType                 folderType,
  92.                                  Boolean                 createFolder,
  93.                                  short *                foundVRefNum,
  94.                                  long *                    foundDirID)                            TWOWORDINLINE(0x7000, 0xA823);
  95.  
  96. #endif  /*  defined(USE_FINDFOLDER_GLUE)  */
  97.  
  98. EXTERN_API( OSErr )
  99. ReleaseFolder                    (short                     vRefNum,
  100.                                  OSType                 folderType)                            TWOWORDINLINE(0x700B, 0xA823);
  101.  
  102.  
  103. /******************************************/
  104. /* Extensible Folder Manager declarations */
  105. /******************************************/
  106.  
  107. /****************************/
  108. /* Folder Manager constants */
  109. /****************************/
  110.  
  111. /* new Folder Manager error codes */
  112.  
  113. enum {
  114.     badFolderDescErr            = -4270,
  115.     duplicateFolderDescErr        = -4271,
  116.     noMoreFolderDescErr            = -4272,
  117.     invalidFolderTypeErr        = -4273,
  118.     duplicateRoutingErr            = -4274,
  119.     routingNotFoundErr            = -4275,
  120.     badRoutingSizeErr            = -4276
  121. };
  122.  
  123.  
  124.  
  125. enum {
  126.     kExtensionDisabledFolderType = FOUR_CHAR_CODE('extD'),
  127.     kControlPanelDisabledFolderType = FOUR_CHAR_CODE('ctrD'),
  128.     kSystemExtensionDisabledFolderType = FOUR_CHAR_CODE('macD'),
  129.     kStartupItemsDisabledFolderType = FOUR_CHAR_CODE('strD'),
  130.     kShutdownItemsDisabledFolderType = FOUR_CHAR_CODE('shdD'),
  131.     kApplicationsFolderType        = FOUR_CHAR_CODE('apps'),
  132.     kDocumentsFolderType        = FOUR_CHAR_CODE('docs')
  133. };
  134.  
  135.  
  136. enum {
  137.                                                                 /* new constants */
  138.     kVolumeRootFolderType        = FOUR_CHAR_CODE('root'),        /* root folder of a volume */
  139.     kChewableItemsFolderType    = FOUR_CHAR_CODE('flnt'),        /* items deleted at boot */
  140.     kApplicationSupportFolderType = FOUR_CHAR_CODE('asup'),        /* third-party items and folders */
  141.     kTextEncodingsFolderType    = FOUR_CHAR_CODE('ƒtex'),        /* encoding tables */
  142.     kStationeryFolderType        = FOUR_CHAR_CODE('odst'),        /* stationery */
  143.     kOpenDocFolderType            = FOUR_CHAR_CODE('odod'),        /* OpenDoc root */
  144.     kOpenDocShellPlugInsFolderType = FOUR_CHAR_CODE('odsp'),    /* OpenDoc Shell Plug-Ins in OpenDoc folder */
  145.     kEditorsFolderType            = FOUR_CHAR_CODE('oded'),        /* OpenDoc editors in MacOS Folder */
  146.     kOpenDocEditorsFolderType    = FOUR_CHAR_CODE('ƒodf'),        /* OpenDoc subfolder of Editors folder */
  147.     kOpenDocLibrariesFolderType    = FOUR_CHAR_CODE('odlb'),        /* OpenDoc libraries folder */
  148.     kGenEditorsFolderType        = FOUR_CHAR_CODE('ƒedi'),        /* CKH general editors folder at root level of Sys folder */
  149.     kHelpFolderType                = FOUR_CHAR_CODE('ƒhlp'),        /* CKH help folder currently at root of system folder */
  150.     kInternetPlugInFolderType    = FOUR_CHAR_CODE('ƒnet'),        /* CKH internet plug ins for browsers and stuff */
  151.     kModemScriptsFolderType        = FOUR_CHAR_CODE('ƒmod'),        /* CKH modem scripts, get 'em OUT of the Extensions folder */
  152.     kPrinterDescriptionFolderType = FOUR_CHAR_CODE('ppdf'),        /* CKH new folder at root of System folder for printer descs. */
  153.     kPrinterDriverFolderType    = FOUR_CHAR_CODE('ƒprd'),        /* CKH new folder at root of System folder for printer drivers */
  154.     kScriptingAdditionsFolderType = FOUR_CHAR_CODE('ƒscr'),        /* CKH at root of system folder */
  155.     kSharedLibrariesFolderType    = FOUR_CHAR_CODE('ƒlib'),        /* CKH for general shared libs. */
  156.     kVoicesFolderType            = FOUR_CHAR_CODE('fvoc'),        /* CKH macintalk can live here */
  157.     kControlStripModulesFolderType = FOUR_CHAR_CODE('sdev'),    /* CKH for control strip modules */
  158.     kAssistantsFolderType        = FOUR_CHAR_CODE('astƒ'),        /* SJF for Assistants (MacOS Setup Assistant, etc) */
  159.     kUtilitiesFolderType        = FOUR_CHAR_CODE('utiƒ'),        /* SJF for Utilities folder */
  160.     kAppleExtrasFolderType        = FOUR_CHAR_CODE('aexƒ'),        /* SJF for Apple Extras folder */
  161.     kContextualMenuItemsFolderType = FOUR_CHAR_CODE('cmnu'),    /* SJF for Contextual Menu items */
  162.     kMacOSReadMesFolderType        = FOUR_CHAR_CODE('morƒ'),        /* SJF for MacOS ReadMes folder */
  163.     kALMModulesFolderType        = FOUR_CHAR_CODE('walk'),        /* EAS for Location Manager Module files except type 'thng' (within kExtensionFolderType) */
  164.     kALMPreferencesFolderType    = FOUR_CHAR_CODE('trip'),        /* EAS for Location Manager Preferences (within kPreferencesFolderType; contains kALMLocationsFolderType) */
  165.     kALMLocationsFolderType        = FOUR_CHAR_CODE('fall')        /* EAS for Location Manager Locations (within kALMPreferencesFolderType) */
  166. };
  167.  
  168.  
  169. /* FolderDescFlags values */
  170.  
  171. enum {
  172.     kCreateFolderAtBoot            = 0x00000002,
  173.     kFolderCreatedInvisible        = 0x00000004,
  174.     kFolderCreatedNameLocked    = 0x00000008
  175. };
  176.  
  177. typedef UInt32                             FolderDescFlags;
  178. /* FolderClass values */
  179.  
  180. enum {
  181.     kRelativeFolder                = FOUR_CHAR_CODE('relf'),
  182.     kSpecialFolder                = FOUR_CHAR_CODE('spcf')
  183. };
  184.  
  185. typedef OSType                             FolderClass;
  186. /* special folder locations */
  187.  
  188. enum {
  189.     kBlessedFolder                = FOUR_CHAR_CODE('blsf'),
  190.     kRootFolder                    = FOUR_CHAR_CODE('rotf')
  191. };
  192.  
  193. typedef OSType                             FolderType;
  194. typedef OSType                             FolderLocation;
  195.  
  196. struct FolderDesc {
  197.     Size                             descSize;
  198.     FolderType                         foldType;
  199.     FolderDescFlags                 flags;
  200.     FolderClass                     foldClass;
  201.     FolderType                         foldLocation;
  202.     OSType                             badgeSignature;
  203.     OSType                             badgeType;
  204.     UInt32                             reserved;
  205.     Str63                             name;
  206. };
  207. typedef struct FolderDesc FolderDesc;
  208.  
  209. typedef FolderDesc *                    FolderDescPtr;
  210.  
  211. typedef UInt32                             RoutingFlags;
  212. struct FolderRouting {
  213.     Size                             descSize;
  214.     OSType                             fileType;
  215.     FolderType                         routeFromFolder;
  216.     FolderType                         routeToFolder;
  217.     RoutingFlags                     flags;
  218. };
  219. typedef struct FolderRouting FolderRouting;
  220.  
  221. typedef FolderRouting *                    FolderRoutingPtr;
  222. /* routing constants */
  223. /***************************/
  224. /* Folder Manager routines */
  225. /***************************/
  226. /* Folder Manager administration routines */
  227. EXTERN_API( OSErr )
  228. AddFolderDescriptor                (FolderType             foldType,
  229.                                  FolderDescFlags         flags,
  230.                                  FolderClass             foldClass,
  231.                                  FolderLocation         foldLocation,
  232.                                  OSType                 badgeSignature,
  233.                                  OSType                 badgeType,
  234.                                  ConstStr63Param         name,
  235.                                  Boolean                 replaceFlag)                        TWOWORDINLINE(0x7020, 0xA823);
  236.  
  237. EXTERN_API( OSErr )
  238. GetFolderDescriptor                (FolderType             foldType,
  239.                                  Size                     descSize,
  240.                                  FolderDesc *            foldDesc)                            TWOWORDINLINE(0x7023, 0xA823);
  241.  
  242. EXTERN_API( OSErr )
  243. GetFolderTypes                    (UInt32                 requestedTypeCount,
  244.                                  UInt32 *                totalTypeCount,
  245.                                  FolderType *            theTypes)                            TWOWORDINLINE(0x7024, 0xA823);
  246.  
  247. EXTERN_API( OSErr )
  248. RemoveFolderDescriptor            (FolderType             foldType)                            TWOWORDINLINE(0x7021, 0xA823);
  249.  
  250. /* legacy routines */
  251. EXTERN_API( OSErr )
  252. GetFolderName                    (short                     vRefNum,
  253.                                  OSType                 foldType,
  254.                                  short *                foundVRefNum,
  255.                                  Str63                     name)                                TWOWORDINLINE(0x700E, 0xA823);
  256.  
  257. /* routing routines */
  258. EXTERN_API( OSErr )
  259. AddFolderRouting                (OSType                 fileType,
  260.                                  FolderType             routeFromFolder,
  261.                                  FolderType             routeToFolder,
  262.                                  RoutingFlags             flags,
  263.                                  Boolean                 replaceFlag)                        TWOWORDINLINE(0x7026, 0xA823);
  264.  
  265. EXTERN_API( OSErr )
  266. RemoveFolderRouting                (OSType                 fileType,
  267.                                  FolderType             routeFromFolder)                    TWOWORDINLINE(0x7027, 0xA823);
  268.  
  269. EXTERN_API( OSErr )
  270. FindFolderRouting                (OSType                 fileType,
  271.                                  FolderType             routeFromFolder,
  272.                                  FolderType *            routeToFolder,
  273.                                  RoutingFlags *            flags)                                TWOWORDINLINE(0x7022, 0xA823);
  274.  
  275. EXTERN_API( OSErr )
  276. GetFolderRoutings                (UInt32                 requestedRoutingCount,
  277.                                  UInt32 *                totalRoutingCount,
  278.                                  Size                     routingSize,
  279.                                  FolderRouting *        theRoutings)                        TWOWORDINLINE(0x701E, 0xA823);
  280.  
  281. EXTERN_API( OSErr )
  282. InvalidateFolderDescriptorCache    (short                     vRefNum,
  283.                                  long                     dirID)                                TWOWORDINLINE(0x7025, 0xA823);
  284.  
  285. EXTERN_API( OSErr )
  286. IdentifyFolder                    (short                     vRefNum,
  287.                                  long                     dirID,
  288.                                  FolderType *            foldType)                            TWOWORDINLINE(0x701F, 0xA823);
  289.  
  290.  
  291.  
  292.  
  293.  
  294. #if PRAGMA_STRUCT_ALIGN
  295.     #pragma options align=reset
  296. #elif PRAGMA_STRUCT_PACKPUSH
  297.     #pragma pack(pop)
  298. #elif PRAGMA_STRUCT_PACK
  299.     #pragma pack()
  300. #endif
  301.  
  302. #ifdef PRAGMA_IMPORT_OFF
  303. #pragma import off
  304. #elif PRAGMA_IMPORT
  305. #pragma import reset
  306. #endif
  307.  
  308. #ifdef __cplusplus
  309. }
  310. #endif
  311.  
  312. #endif /* __FOLDERS__ */
  313.  
  314.